package simulator.labyrinth;

import simulator.position.Point;
import Robot.SensorColour;

public class Line extends Obstacle {
	private SensorColour colour;
	
	public Line(Point start, Point end, SensorColour colour) {
		super(start, end);
		
		this.colour = colour;
	}
	
	//default:colour = WHITE
	public Line(Point start, Point end){
		this(start, end, SensorColour.WHITE);
	}
	
	public Line(int x1, int y1, int x2, int y2)
	{
		super(new Point(x1, y1), new Point(x2, y2));
	}
	
	public SensorColour getColour(){
		return colour;
	}
	
	@Override
	public int hashCode() {
		String str = this.getStartPosition().hashCode() + " --- " + this.getEndPosition().hashCode();
		return str.hashCode();
	}
	
	@Override
	public boolean equals(Object other) {
		if (!(other instanceof Line))
			return false;
		Line otherLine = (Line) other;
		return this.getStartPosition().equals(otherLine.getStartPosition()) && this.getEndPosition().equals(otherLine.getEndPosition());
	}
	
	public int getX1()
	{
		return getStartPosition().getX();
	}
	
	public int getX2()
	{
		return getEndPosition().getX();
	}
	
	public int getY1()
	{
		return getStartPosition().getY();
	}
	
	public int getY2()
	{
		return getEndPosition().getY();
	}
}

